package org.timeticker;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Object List interface.
 *
 * @author Ivan Latysh
 * @version 0.1
 * @since 16-Jul-2007 : 7:37:26 PM
 */
public interface ObjectList<T> extends Serializable {

  /**
   * Rerturn all objects from this list
   *
   * @return all objects
   */
  public List<T> getObjects();

  /**
   * Set objects to this list
   *
   * @param objects object to set
   */
  public void setObjects(List<T> objects);

  /**
   * Return modified flag
   *
   * @return <tt>true</tt> is this list is modified, <tt>false</tt> when not
   */
  public boolean isModified();

  /**
   * Update modified flag
   *
   * @param modified modified flag
   */
  public void setModified(boolean modified);

  /**
   * Return list size
   *
   * @return list size
   */
  public int size();

  /**
   * Add object
   *
   * @param object object to add
   * @return <tt>true</tt> when object successfully added
   */
  public boolean add(T object);

  /**
   * Remove object
   *
   * @param object object to remove
   * @return <tt>true</tt> if object successfully removed
   */
  public boolean remove(T object);

  /**
   * Set object at given index.
   *
   * @param index object index to replace
   * @param object object
   * @return <tt>true</tt> if object successfully updated
   */
  public boolean set(int index, T object);

  /**
   * Return object at index
   *
   * @param index index
   * @return onject
   */
  public T get(int index);

  /**
   * Return object by it's key
   *
   * @param key object key
   * @return object
   */
  public T get(String key);

  /**
   * Return undex of object
   *
   * @param object object
   * @return object index
   */
  public int indexOf(T object);

  /**
   * Check if list contain given object
   *
   * @param object object
   * @return <tt>true</tt> when list contain given object, <tt>false</tt> otherwise
   */
  public boolean contains(T object);

  /**
   * Add listener
   *
   * @param l listener to add
   */
  public void addListener(ObjectListListener l);

  /**
   * Remove listener
   *
   * @param l listener to remove
   */
  public void removeListener(ObjectListListener l);

}
